package com.zeei.ems.meet.controller;

import com.zeei.ems.base.constant.GlobalConstant;
import com.zeei.ems.base.controller.BasicController;
import com.zeei.ems.base.result.ResultRowsVO;
import com.zeei.ems.meet.model.EquipVO;
import com.zeei.ems.meet.model.VideoVO;
import com.zeei.ems.meet.model.vo.EquipParam;
import com.zeei.ems.meet.model.vo.VideoParam;
import com.zeei.ems.meet.service.EquipService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "设备管理接口")
@RestController
@RequestMapping("/ems/equip")
public class EquipController extends BasicController {
    @Autowired
    EquipService equipService;

    /**
     * 查询设备数据列表
     * @param pointCode 站点编码
     * @return 返回设备数据列表
     */
    @ApiOperation(value = "查询设备数据列表")
    @PostMapping("/list")
    public ResultRowsVO<EquipVO> listEquip(Integer pointCode){
        EquipParam equipParam = new EquipParam();
        equipParam.setPointCode(pointCode);
        List<EquipVO> equipList = equipService.listEquip(equipParam);
        return this.createResultRowsVO(equipList, GlobalConstant.SUCCEED, equipList.size());
    }

    /**
     * 查询设备状态数据列表
     * @param equipParam 设备数据列表
     * @return 返回设备状态数据列表
     */
    @ApiOperation(value = "查询设备状态数据列表")
    @PostMapping("/list/data")
    public ResultRowsVO<EquipVO> listEquipData(@RequestBody EquipParam equipParam){
        List<EquipVO> equipList = equipService.listEquipData(equipParam);
        return this.createResultRowsVO(equipList, GlobalConstant.SUCCEED, equipList.size());
    }
}
